#include "wordtest.h"
#include "literals/delta.h"
#include "literals/operator.h"
#include "literals/variable.h"

WordTest::WordTest(QObject *parent) :
  QObject(parent)
  {
  }

void WordTest::initTestCase()
  {
  }

void WordTest::testIsGreaterThan()
  {
  Delta deltaXY("delta", "x", "y");
  Delta deltaAB("delta", "a", "b");

  QCOMPARE(deltaXY.isGreaterThan(deltaAB), true);
  QCOMPARE(deltaAB.isGreaterThan(deltaXY), false);

  Variable a("a"), aa("aa"), z("z");

  QCOMPARE(aa.isGreaterThan(a), true);
  QCOMPARE(aa.isGreaterThan(z), false);
  QCOMPARE(a.isGreaterThan(aa), false);
  QCOMPARE(a.isGreaterThan(z), false);
  QCOMPARE(z.isGreaterThan(a), true);
  QCOMPARE(z.isGreaterThan(aa), true);

  QCOMPARE(aa.isGreaterThan(a), (a.getText().compare( aa.getText()) < 0));
  QCOMPARE(aa.isGreaterThan(z), (z.getText().compare( aa.getText()) < 0));
  QCOMPARE(a.isGreaterThan(aa), (aa.getText().compare( a.getText()) < 0));
  QCOMPARE(a.isGreaterThan(z), (z.getText().compare( a.getText()) < 0));
  QCOMPARE(z.isGreaterThan(a), (a.getText().compare( z.getText()) < 0));
  QCOMPARE(z.isGreaterThan(aa), (aa.getText().compare( z.getText()) < 0));
  }

void WordTest::cleanupTestCase()
  {  }

